package com.team.panicgame.screens.gareve;

import aurelienribon.tweenengine.Tween;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.input.GestureDetector;
import com.team.panicgame.PanicGame;
import com.team.panicgame.input.GameInputListener;
import com.team.panicgame.models.InputStatus;
import com.team.panicgame.models.gareve.GareveWorld;
import com.team.panicgame.models.gareve.ShipParticle;
import com.team.panicgame.models.gareve.ShipParticleAccesor;
import com.team.panicgame.view.gareve.GareveRenderer;

public class GareveScreen implements Screen {
	PanicGame panicGame;
	
	GareveWorld world;
	GareveRenderer renderer;
	InputStatus inputStatus;
	
	public GareveScreen(PanicGame panicGame){
		this.panicGame = panicGame;
		
		Tween.registerAccessor(ShipParticle.class, new ShipParticleAccesor());
	}
	
	@Override
	public void render(float delta) {
		world.update(delta);
		renderer.render();
	}

	@Override
	public void resize(int width, int height) {
	}

	@Override
	public void show() {
		inputStatus = new InputStatus();
		world = new GareveWorld(inputStatus);
		renderer = new GareveRenderer();
		
		GameInputListener gameInputListener = new GameInputListener(inputStatus);
		InputMultiplexer multiplexer = new InputMultiplexer(gameInputListener,new GestureDetector(gameInputListener));
		
		Gdx.input.setInputProcessor(multiplexer);
		
		renderer.setFirstGameWorld(world);
		
	}

	@Override
	public void hide() {
	}

	@Override
	public void pause() {
	}

	@Override
	public void resume() {
	}

	@Override
	public void dispose() {
	}

}
